const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {

  entry: './src/index.ts',

  mode: 'development',

  output: {
    path: path.resolve(__dirname, "dist"),
    filename: "bundle.js",
  },

  module: {
    rules: [
      {
        test: /\.ts$/,
        use: "ts-loader",
        exclude: /node_modules/
      }
    ]
  },

  plugins: [
    new HtmlWebpackPlugin(
      {
        template: "./src/index.html",
        title: "你好 ts + webpack"
      }
    ),
  ],

  // 设置引用模块
  resolve: {
    extensions: ['.ts', '.js']
  }

}